XNA `tex2Dlod` always returns transparent black

Posted by feralin on Game Development See other posts from Game Development or by feralin
Published on 2014-08-23T17:58:33Z Indexed on 2014/08/23 22:36 UTC
Read the original article Hit count: 536

Filed under:
|
|

I want to sample a texture in a vertex shader, so at first I just tried using

float2 texcoords = ...;
color = tex2D(texture, texcoords);

But apparently I cannot use tex2D in a vertex shader, and must use tex2Dlod. So then I changed the above code to

color = tex2Dlod(texture, float4(texcoords, 0, 0));

But now color is always float4(0, 0, 0, 0) (i.e. transparent black).

Why is this, and how can I fix it?

EDIT: I know for a fact that the texture does not contain just transparent black pixels.

© Game Development or respective owner

Related posts about XNA

Related posts about shaders